
package cz.czu.pef.DataModelling.ejb.impl;

import java.util.logging.*;

import javax.ejb.*;

import cz.czu.pef.DataModelling.dao.DaoBasic;
import cz.czu.pef.DataModelling.domainObjects.Company;
import cz.czu.pef.DataModelling.ejb.api.*;
import cz.czu.pef.DataModelling.service.api.*;
import cz.czu.pef.DataModelling.utils.SpringLoader;

@Stateless(name = "companyEJB", mappedName = "companyEJB")
@Remote
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class CompanyEjbImpl extends AbstractEjbImpl<Company> implements CompanyEjbInterface
{
  Logger logger = Logger.getLogger(CompanyEjbImpl.class.getName());

  CompanyService companyService;

  @Override
  public DaoBasic<Company> getDaoBasic()
  {
    companyService = SpringLoader.getContext().getBean(CompanyService.class);
    return companyService;
  }

  @Override
  public boolean canBeRemoved(Company company)
  {
    companyService = SpringLoader.getContext().getBean(CompanyService.class);
    return companyService.canBeRemoved(company);
  }
}
